package myDaos;

import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.Query;

@Stateless
public class ProceduresDao {
	@PersistenceContext(unitName = "UnileverProcedure")
    private EntityManager em;
	
	public EntityManager getEntityManager() {
        return em;
    }
	
	public void callMyProcedure(String param1,int param2,String param3,String param4){
		try {
		    Query q = getEntityManager().createNativeQuery("{call chub_SQL_LOADER_cntry(:p1, :p2, :p3, :p4)}").setParameter("p1",param1).setParameter("p2",param2).setParameter("p3",param3).setParameter("p4",param4);
		    q.executeUpdate();
	} catch (Exception e) {
		e.printStackTrace();
	}
	}

}
